package com.example.demo6.SQLite;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao
public interface LostGoodsDao {
    @Insert
    void insertLostGoods(LostGoods lostGoods);
    @Delete
    void deleteLostGoods(LostGoods lostGoods);
    @Update
    void updateLostGoods(LostGoods lostGoods);
    @Query("select * from lostGoods where goodsId=:goodsId")
    LostGoods getLostGoodsByGoodsId(int goodsId);
    @Query("select * from lostGoods")
    LiveData<List<LostGoods>> getLostGoods();

    @Query("select * from lostGoods where loser=:Username")
    LiveData<List<LostGoods>> getLostGoodsByUsername(String Username);

    @Query("select * from lostGoods where goodsId=:goodsId")
    LostGoods getMyLostGoodsByGoodsId(int goodsId);

    @Update
    void updateMyLostGoods(LostGoods lostGood);

    @Query("DELETE FROM LostGoods WHERE goodsId = :goodsId")
    void deleteMyLostGoodsById(int goodsId);

}
